# Creating a new External Payment

Creates an external payment for the specified project or invoice. If an invoice ID is provided, a
payment is only created for that invoice when it's a single project invoice and in a non-draft pending state.
This endpoint returns structured External Payment objects.
As with all Kantata OX API endpoints, the returned data will be referenced in sorted order in the `results` array
and will be indexed by ID in the `external_payments` top-level JSON key.
Please see our [Response Format](#section/Response-Format) section for more information.

Endpoint: POST /external_payments
Version: 1.0.0

## Query parameters:

  - `include` (string)
    Any of the below associations can be included in your request by providing the `include` param, e.g. `include=association1,association2`.
- `invoice` (Invoice) - The invoice (if any) for which the external payment was created.
- `user` (User) - The user who created the external payment.
- `workspace` (Workspace) - The project in which the external payment was created.

## Request fields (application/json):

  - `external_payment` (object)

  - `external_payment.workspace_id` (integer, required)
    The ID of the project in which the payment will be created.

  - `external_payment.invoice_id` (integer)
    The ID of the invoice (if any) that is being paid by the external payment.  This automatically sets the amount
attribute of the payment to the amount of the specified invoice, and will override any `amount_in_cents` parameter sent.

  - `external_payment.amount_in_cents` (integer)
    Indicates that the payment is not for an invoice, and will be ignored if an `invoice_id` is provided.
Must be in base cent units of the currency of the project in which the payment is created.

  - `external_payment.message` (string)
    An optional string describing the payment (255 characters maximum).

## Response 200:

  - `200` (unknown)
    External Payment has been created.

## Response 200 fields (application/json):

  - `count` (integer)

  - `meta` (object)

  - `meta.count` (integer)

  - `meta.page_count` (integer)

  - `meta.page_number` (integer)

  - `meta.page_size` (integer)

  - `results` (array)

  - `results.key` (string)

  - `results.id` (string)

  - `external_payments` (object)

  - `users` (object)

  - `workspaces` (object)

  - `invoices` (object)

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 401:

  - `401` (unknown)
    Unauthorized request

## Response 401 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 403:

  - `403` (unknown)
    Forbidden request

## Response 403 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 404:

  - `404` (unknown)
    Page Not Found

## Response 404 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 422:

  - `422` (unknown)
    Unprocessable Entity

## Response 422 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

## Response 503:

  - `503` (unknown)
    Service is unavailable

## Response 503 fields (application/json):

  - `errors` (array)

  - `errors.type` (string)

  - `errors.message` (string)

